package com.wangy.mapper;

import com.wangy.bean.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * *@Author yyzb
 * *@Date 2024/10/22 16:47
 * *@Version 1.0
 */

@Mapper
public interface UserMapper{
    @Select("select id, username, password from user where username = #{username}")
    List<User> getUserByName(String username);

    List<User> getAllUsers();

    @Select("select id, username, password from user where id = #{id}")
    List<User> getUserById(Long id);

    void addUser(User user);

    @Delete("delete from user where id = #{id}")
    void deleteById(Long id);
}
